package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 请求结果类型 <br>
 * 描述：<br>
 * 0：失败；1：成功；
 * 
 * @author Davey.wu
 */
public enum ReqResultType {

	FAILURE("0"), SUCCEED("1");

	public static final String TypeCode = "10001";

	public final String ValueCode;

	private ReqResultType(String code) {
		this.ValueCode = code;
	}

	public static ReqResultType get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (ReqResultType type : ReqResultType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
